package com.potenza.training.interview.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.potenza.training.interview.dao.InterviewClassDao;
import com.potenza.training.interview.entity.InterviewClassEntity;
import com.potenza.training.interview.service.InterviewClassService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


@Service("interviewClassService")
public class InterviewClassServiceImpl extends ServiceImpl<InterviewClassDao, InterviewClassEntity> implements InterviewClassService {

    @Autowired
    InterviewClassDao interviewClassDao;
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<InterviewClassEntity> page = this.page(
                new Query<InterviewClassEntity>().getPage(params),
                new QueryWrapper<InterviewClassEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public List<InterviewClassEntity> findByStudent(Integer studentId) {
        QueryWrapper<InterviewClassEntity> queryWrapper = new QueryWrapper<InterviewClassEntity>();
        queryWrapper.lambda().eq(InterviewClassEntity::getStudentId,studentId);
        return interviewClassDao.selectList(queryWrapper);
    }

}